Adding function: loger(), record_amount() and main function