finished problems 5, 6

less voodoo this time, more just code