Code clean up

Cleaned up code and beginning to add scaling