refactor: create Signal class and encapsulate functionality