rough version of enumeration
minor improvements but still not working