implementation of topiclock, corrected db_schema and structs for topiclock