Rearranged library to match Neil order

Also changed some names to match Neil’s definitions and wrote down
missing parts to complete