this thing is starting to get nasty, so many try catches