Cleaned up code put comments