Implement restart functionality. TODO: make it work