fixed failing tests cause
added validation if no field is selected
wrote unittest if no field is selected
refactored repeated code