Initial Working code