Fixed broken code. Old version.