introduced locking + reading initial params from files