improving the implementation