cleaning up for class, moving javascript to separate file