updated for windows, rectangle collision detection