Prepared code for final submission