add buttons on sidebar and cleanup code