Cleaned up code a bit, fixed all errors.