Complete and total refactor of optp.