Skeletonized, made lots of improvements