Cleaned up hierarchy and code