Cleaned, commented, and added extendability.