Partial Sin implementation; utility functions