cleaning up
replacing long conditionals with function calls
providing funciton params
adding in some debug statements
Merge pull request #16 from ruebenramirez/master

a bit of cleanup

thanks =)