v0.5 All original functions have been modified by ashnh