Cleaned up and refined class code.