Start from beginning.  Go back to working code with a lot of repetition
Try php to modularize code