Add grunt scripts and dependencies and refactor code and structure