abit beautifulized, but now complete