Reformatted code and deleted unused code fragments.