My version of S5, rewritten and more modular, derived from version 1.1.