refactor and finish up slave class