added once and some performance improvements