Added threading and some commands to daemon