Fixed some problems and validated it