Buggy implementation of hopefully optimized forward pass.  Work in progress.