Seperated source code from main for clarity