cleaned files and added some payment logic