final refactoring done - validity error still remains