Remote revamp (director's cut)

This is the new PR, same as the old one, but without segfaults and working push tests.