implemented __clone(), reordered some methods in source code