Use code tags if you post code examples. Good start would be to draft your idea before you actually begin coding it. It is easier to throw a blue print than a 1000 line program