moving bin code so it can be ran independant