Changed how the "off" function works, still requires tweaking; bugfixes