New function starting
logic works
Made modular