regular code for improving efficiency