Refactoring: divided core.k into 4 other files, for some basic modularity. Some minor todo-s resolved.