Cleaned up some redundant javascript functions.