Cleaned up code, changed controller design