added constants and fixed bugs with handler