Removed redundant code, replaced colorboxes with a function