Code refactor to simplify base functionality