restructuring functions and adding all html elements dynamically with js