cleaned up code a little bit
updated to use bipy objects