Moved logic into separate class, tested over network instead of localhost