Make Python 3 compatible

Just thought I'd make an attempt at making the code Python 3 compatible (3.3.3 on my machine)