Cleaned up algorithms module further. Made generation of various helper sequences more pythonic.