many refactors. code now uses implicit returns.