Removed redundancies to simplify code