Flesh out implementation part, fix some mistakes