Cleanup

1) Constants brought to #define's. 
2) Removed some boilerplate.