Cleaned up code / fixed errors.