moved stuff into demo folder
refactored some code.