added all necessary checks \o/