Labels for forward/backward become A/B respectively
Made some functions public for testing purposes; added utility functions
in push to modularize code.