console reimplementation,
optimisations