adding mode functionality