made implementation of constraints flatter