Fixed bug that prevented the insert bar button from appearing. Cleaned up code