re-organise the project, fix bugs