Removed calls to #id almost everywhere, refactored a lot of code.