Renamed variables, added explicit flush. Fixes #67