Finalized code & added testing mode