Cleanup mostly

- Re-arranged functions
- Added sane oop checks
- Added basic panel code