Cleaned up ugly code and fixed error styles