moved functions to their respective js files. Added current thread if one exists, otherwise new thread button