Cleaning code, adding some types