Updated code and added P28 and P45

Updated for readability and speed