fixed #2 and made the code a LOT less lines about 18 lines less