Main.js refactored, readme.md added