Cleaned up couple duplicated functions.