Added colored error message and removed needless function