renamed predicates and added comments
optimized ID generation
got rid of appends