Fixed some bugs, cleaned up runnable loops