removed redundant method and implemented distinction for nils
refactoring
refactoring