made workable set of code