Forked and updated for litecoin