changed ordering of functions
fold away html declarions
cleaner code