Cleaned up code and added control documentation