Some improvements and additions. Working on the rest.