Fix /buy host

Also beautified the code