Implementation of API removed repeated code sections