Fixed generic func, removed old code