Remove some repetitve code