Fixed errors. Fully working version.