moved code around, enabled enum support