Refactor a little and start messing around with cython