created some changes to the code so that it looks better and may be closer to working