Cleaned up to be smaller and have correct comments