added functions for insert / select from db
changed some methods in k nearest class + manager