Added lucene scoring and code refactoring