Refactored UI library, updated rest of engine