Refactoring & adding value checks