Fixed bugs. js in separate file.