Improved API handling

Signed-off-by: HaGoijer <henrikgoijer@gmail.com>