Initial commit of actual working experimental code.
Added option for custom return codes.