Refactory to become more consistent and support custom messages.